﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Theme_DL_UserControls_RealTimeData : System.Web.UI.UserControl
{
    PowerCreator.LMS.ViewQuery.ViewQuery opViewQuery = new PowerCreator.LMS.ViewQuery.ViewQuery();
    protected PowerCreator.LMS.Web.Config.WebConfig config = new PowerCreator.LMS.Web.Config.WebConfig();
    private int theDayNumOfWeek = 1;
    protected void Page_Load(object sender, EventArgs e)
    {
        BinderWebClick();
    }
    private void BinderWebClick()
    {
        //访问统计
        //今日在线
        PowerCreator.LMS.Web.DL.Project.TOLearner opLearner = new PowerCreator.LMS.Web.DL.Project.TOLearner();
        PowerCreator.LMS.Web.Course.Resource opResource = new PowerCreator.LMS.Web.Course.Resource(); 
        PowerCreator.LMS.Web.DL.User.WebLearner opWebLearner = new PowerCreator.LMS.Web.DL.User.WebLearner();
        PowerCreator.LMS.ViewQuery.ViewQuery obj = new PowerCreator.LMS.ViewQuery.ViewQuery();                                                                                                                                                                                                                       

        //PowerCreator.LMS.Web.User.User opUser = new PowerCreator.LMS.Web.User.User();
        string search = "";
        lbl_LearnerRegistorCount.Text = opLearner.Count(search).ToString();
        lbl_ResourceCount.Text = opResource.QueryResourceCount(search).ToString();
        search = " OnlineuserType=2";
        lbl_UserToDayHistoryOnline.Text = opWebLearner.QueryOnlineUserCount(search).ToString();
        lbl_UserToDayHistoryOnline02.Text = lbl_UserToDayHistoryOnline.Text;
        search = " select distinct FKOnlineuserUserId,OnlineuserLoginIp from TOnlineUser where OnlineuserType=2 and UserOnlineState = 1";
        lbl_OnlineLearnerCount.Text = obj.Count(search).ToString();

        //lbl_UserToDaCurrentyOnline.Text = opUser.QueryCurrentOnlineUser().ToString();
        //search = string.Format("convert(varchar(12),OnlineuserLoginTime,112) = '{0}'", DateTime.Now.ToString("yyyyMMdd"));
        //lbl_UserToDayOnline.Text = opUser.QueryOnlineUserCount(search).ToString();
        //search = string.Format("convert(varchar(12),OnlineuserLoginTime,112) > '{0}' and convert(varchar(12),OnlineuserLoginTime,112) < '{1}'", DateTime.Now.AddDays(0 - theDayNumOfWeek).ToString("yyyyMMdd"), DateTime.Now.AddDays(8 - theDayNumOfWeek).ToString("yyyyMMdd"));
        //lbl_UserToDayWeekOnline.Text = opUser.QueryOnlineUserCount(search).ToString();
    }

}
